package com.wish.wishhouse_resource.controller;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wish.wishhouse_resource.entity.TbRoomReservation;
import com.wish.wishhouse_resource.service.ITbRoomReservationService;
import dto.houseResourceDto.ReservationDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import vo.ResultEntity;

import java.util.List;

/**
 * <p>
 * 预约房源表 前端控制器
 * </p>
 *
 * @author zhangshuxin
 * @since 2021-03-29
 */
@RestController
@RequestMapping("/tbRoomReservation")
public class TbRoomReservationController {

    @Autowired
    private ITbRoomReservationService iTbRoomReservationService;

    //列表展示
    @RequestMapping("/list")
    public ResultEntity list(ReservationDto reservationDto) {
        System.out.println(reservationDto);
        //分页
        PageHelper.startPage(reservationDto.getPageNum(), reservationDto.getPageSize());
        //查询
        List<TbRoomReservation> list = iTbRoomReservationService.listAll(reservationDto);
        //封装
        PageInfo<TbRoomReservation> info = new PageInfo<>(list);
        return ResultEntity.ok("200", "列表查询成功", info);
    }
}

